package com.zkzx.company.base.controller;

import com.zkzx.company.base.service.sms.SmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zhaoyihe
 * @Date: 2021/06/29/12:45
 * @Description:
 */
@RestController
@Validated
@Api( tags="短信")
@RequestMapping(value = "/sms")
public class SmsController {

    @Autowired
    private SmsService smsService;

    /**
     * 阿里云短信接口
     * @param phoneNumbers  电话号码
     * @param templateCode  模板编号
     * @param templateParam 发送参数
     * @return
     */
    @GetMapping
    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "发送短信", notes = "发送短信")
    public Boolean sendSms(@RequestParam("phone_numbers") String phoneNumbers, @RequestParam("template_code") String templateCode, @RequestParam("template_param") String templateParam){
       return smsService.sendSms(phoneNumbers,templateCode,templateParam);
    }
}
